import React from 'react'
import ReactDOM from 'react-dom/client'
//import { createRoot } from 'react-dom/client'
import '@/index.scss' //全局样式
import App from './App'
import reportWebVitals from './reportWebVitals' //性能测试
import 'antd/dist/antd.min.css' // antd组件库样式
import { ConfigProvider } from 'antd' // 全局国际化配置
import 'moment/locale/zh-cn' // 中文语言包
import zhCN from 'antd/lib/locale/zh_CN'
import { Provider } from 'react-redux' //集成redux到react
import store from './store' //全局状态
import { HistoryRouter, history } from '@/router/history'

const root = ReactDOM.createRoot(document.getElementById('root'))

console.log('环境变量：', process.env)
if (process.env.NODE_ENV === 'production') {
  // 只有生产环境重新日志方法为空
  console.log = console.warn = () => {}
}
root.render(
  <React.StrictMode>
    <HistoryRouter history={history}>
      <Provider store={store}>
        <ConfigProvider locale={zhCN}>
          <App />
        </ConfigProvider>
      </Provider>
    </HistoryRouter>
  </React.StrictMode>
)
// createRoot(document.getElementById('root')).render(
//   <HistoryRouter history={history}>
//     <Provider store={store}>
//       <ConfigProvider locale={zhCN}>
//         <App />
//       </ConfigProvider>
//     </Provider>
//   </HistoryRouter>
// )

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals(console.log)
